const express = require('express');
// const { data } = require('jquery');
const path = require('path')

const app = express();

console.log('111');

//查询学生信息接口
app.get('/user',(req,res)=>{


    const {
        userId
    }=req.query;

    if(userId !=='001'){
        
        return res.send({

            code : 10001,
            msg  : '查询失败',
            data :null

        });

        
    }
    console.log('1');

    res.send({
        code : 10000,
        msg : '查询成功',
        data:{
            name : '老李',
            age  : 18,
            sex  : '男'
        }
    });
    
    



})





app.get('/1',(req,res)=>{
    const filePath = path.resolve(__dirname,'./index.html')
    res.sendFile(filePath)
})

app.listen(8080,()=>{
    console.log('服务器启动成功 http://127.0.0.1:8080/1');
})